﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections;



    public partial class Stock
    {
        public Stock(Dictionary<String, String> stockProperties)
        {
            foreach (string s in stockProperties.Keys)
            {
                if (s.Equals("Allocated"))
                {
                    Allocated = Convert.ToInt32(stockProperties[s]);
                }

                if (s.Equals("BackHold"))
                {
                    BackHold = Convert.ToInt32(stockProperties[s]);
                }

                if (s.Equals("BackOrder"))
                {
                    BackOrder = Convert.ToInt32(stockProperties[s]);
                }      

                if (s.Equals("Code"))
                {
                    Code = stockProperties[s];
                }

                if (s.Equals("Cost"))
                {
                    Cost = Convert.ToDouble(stockProperties[s]);
                }

                if (s.Equals("Description"))
                {
                    Description = stockProperties[s];
                }

                if (s.Equals("Item"))
                {
                    Item = stockProperties[s];
                }

                if (s.Equals("Location"))
                {
                    Location = stockProperties[s];
                }

                if (s.Equals("Name"))
                {
                    Name = stockProperties[s];
                }

                if (s.Equals("OnOrder"))
                {
                    OnOrder = Convert.ToInt32(stockProperties[s]);
                }

                if (s.Equals("ReOrder"))
                {
                     Reorder = Convert.ToInt32(stockProperties[s]);
                }

                if (s.Equals("S1Code"))
                {
                    S1Code = stockProperties[s];
                }

                if (s.Equals("S1PartNo"))
                {
                    S1PartNo = stockProperties[s];
                }

                if (s.Equals("Sell"))
                {
                     Sell = Convert.ToDouble(stockProperties[s]);
                }

                if (s.Equals("StockID"))
                {
                     StockID = Convert.ToInt32(stockProperties[s]);
                }

                if (s.Equals("StockIn"))
                {
                     StockIn = Convert.ToInt32(stockProperties[s]);
                }

                if (s.Equals("Supplier"))
                {
                    Supplier = stockProperties[s];
                }

                if (s.Equals("Type"))
                {
                    Type = stockProperties[s];
                }

                if (s.Equals("UnitMeasure"))
                {
                    UnitMeasure = stockProperties[s];
                }
            }
        }

        public static ArrayList GetPropertyList()
        {
            ArrayList propertyList = new ArrayList();
            propertyList.Add("Allocated");
            propertyList.Add("BackHold");
            propertyList.Add("BackOrder");
            propertyList.Add("Code");
            propertyList.Add("Cost");
            propertyList.Add("Description");
            propertyList.Add("Item");
            propertyList.Add("Location");
            propertyList.Add("Name");
            propertyList.Add("OnOrder");
            propertyList.Add("ReOrder");
            propertyList.Add("S1Code");
            propertyList.Add("S1PartNo");
            propertyList.Add("Sell");
            propertyList.Add("StockID");
            propertyList.Add("StockIn");
            propertyList.Add("Supplier");
            propertyList.Add("Type");
            propertyList.Add("UnitMeasure");

            return propertyList;
        }

    }

